<?php

declare(strict_types=1);

namespace app\validate\org;

use think\Validate;

class OrgAuditQuickCreateValidate extends Validate
{
    protected $rule = [
        'account.phone' => ['require', 'regex:^1\\d{10}$'],
        'account.password' => 'require|min:6',
        'account.nickname' => 'max:50',
        'account.real_name' => 'max:50',
        'company.company_name' => 'require|max:150',
        'company.license_code' => 'require|max:64',
        'company.legal_rep' => 'require|max:50',
        'company.address' => 'require|max:255',
        'company.region_id' => 'require|integer|gt:0',
        'invoice.invoice_title' => 'max:150',
        'invoice.invoice_taxno' => 'max:64',
    ];

    protected $message = [
        'account.phone.require' => '请填写登录手机号',
        'account.phone.regex' => '手机号格式不正确',
        'account.password.require' => '请设置登录密码',
        'account.password.min' => '登录密码至少 6 位',
        'account.nickname.max' => '昵称长度不能超过 50 个字符',
        'account.real_name.max' => '姓名长度不能超过 50 个字符',
        'company.company_name.require' => '请填写企业名称',
        'company.company_name.max' => '企业名称长度不能超过 150 个字符',
        'company.license_code.require' => '请填写统一社会信用代码',
        'company.license_code.max' => '统一社会信用代码长度不能超过 64 个字符',
        'company.legal_rep.require' => '请填写法人代表姓名',
        'company.legal_rep.max' => '法人代表姓名长度不能超过 50 个字符',
        'company.address.require' => '请填写企业注册地址',
        'company.address.max' => '注册地址长度不能超过 255 个字符',
        'company.region_id.require' => '请选择所属区域',
        'company.region_id.integer' => '所属区域格式不正确',
        'company.region_id.gt' => '所属区域格式不正确',
        'invoice.invoice_title.max' => '开票抬头长度不能超过 150 个字符',
        'invoice.invoice_taxno.max' => '纳税人识别号长度不能超过 64 个字符',
    ];

    protected $scene = [
        'create' => [
            'account.phone',
            'account.password',
            'account.nickname',
            'account.real_name',
            'company.company_name',
            'company.license_code',
            'company.legal_rep',
            'company.address',
            'company.region_id',
            'invoice.invoice_title',
            'invoice.invoice_taxno',
        ],
    ];
}
